<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>后台管理系统</title>
<link href="../Public/admin/css/golbal.css" rel="stylesheet" type="text/css" />
<link href="../Public/admin/css/addmember.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../Public/css/sub_back.css"/>
<load href="__PUBLIC__/Js/kindeditor/kindeditor-min.js" />
<js href="__PUBLIC__/Js/Jquery/jquery-1.4.4.min.js" />
<script type="text/javascript">
KE.show({
	id : 'desc',
	height:150,
	width:400,
	resizeMode : 1,
	imageUploadJson : '{:U("file/upload")}',
	fileManagerJson : '{:U("file/manage")}',
	allowPreviewEmoticons : false,
	allowUpload : true,
	allowFileManager : true,
	afterCreate : function(id) {
		KE.util.focus(id);
	},
	items : [
	'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
	'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
	'insertunorderedlist', '|', 'link']
});
function changeVerify(){
	var timenow = new Date().getTime();
	 document.getElementById('verifyImg').src='__URL__/verify/'+timenow; 
	}

$(document).ready(function(){
$("#catepid").change(function(){
    var a = $(this).val();
    if(a == 0) return false;	
    $.post("{:U('Resource/showsid')}", {pid:a}, function(res){
    	$('#cateid').html(res);
   		if(res == '0'){
   			$('#catepid').css({'width':290,'height':25});
   			$('#span').hide();
   		}else{
   			$('#span').show();
   			$('#span').html(res);
   			$('#cateid,#catepid').css({'width':145,'height':25});
   			document.getElementById('catepid').style.border="1px solid #dcdcdc";
   			document.getElementById('cateid').style.border="1px solid #dcdcdc";
   		}
	});
});
 $('#verify').blur(function(){
	 var b = $(this).val();
	 $.post("{:U('Resource/checkverify')}",{val:b},function(res){
		if(res=='1')  $('#sp').html("<font class= 'wrong'color='red'>验证码有误</font>");
		else $('#sp').html('');
	 });
 }).keyup(function(){
	 $(this).triggerHandler('blur');
 });
  $('#title').blur(function(){
	  var reg = /^\s*$/g;
	  if($('#title').val()=="" || reg.test($('#title').val())){
		  $('#tit').html("<font class= 'wrong' color='red'>标题不能为空</font>");
		  return false;
	  }
	  else if ($('#title').val().length<=20&&$('#title').val().length>=1) $('#tit').html("<font color='green'>正确</font>");
	  else $('#tit').html("<font class= 'wrong' color='red'>必须是1~20个字符</font>");
  }).keyup(function(){
		 $(this).triggerHandler('blur');
  });

	$('#su').live("click", function(){
		$(".tid").fadeOut(function(){
			$("#fade").remove();
			window.location.href="{:U('Resource/addarticle')}";
		});
		
		return false;
	});
	$('#imageurl').change(function(){
		var vall=$(this).val();
		$('#backstyle_00').html(vall);
		
	})
		$('#url').change(function(){
		var va=$(this).val();
		$('#backstyle_01').html(va);
	})
       
	   $('#sub').click(function(){
		   $('#title').trigger('blur');
			 var b = $('#verify').val();
			 $.post("{:U('Resource/checkverify')}",{val:b},function(res){
				if(res=='1')  $('#sp').html("<font class='wrong' color='red'>验证码有误</font>");
				else $('#sp').html('');
				var numError=$('.wrong').length; 
			    if(numError) return false;
			    else $('#upload').submit();
			 });
		    
	   });
});
</script>
</head>

<body>
<div class="tittle">
<span>编辑文章</span>
<a href="{:U('Resource/article')}">返 回</a>
</div>

<div class="content">
	<div class='tab'>
		<form id="upload" method='post' action="{:U('Resource/editarticle',array('aid'=>$aid))}" enctype="multipart/form-data">
			<table  align='center' >
				<if condition="($_GET['erorsta'] eq 1)">
					<tr>
						<td colspan='3' style='text-align:center; color:red;'>{$error}</td>
					</tr>
				</if>
				<tr height='45px'>
					<td width='100px' align='right'><span style='color:red'>*</span><font color='#606062'>标题:</font>&nbsp&nbsp</td>
					<td align='left'><input type="text" name="title" class='title' id='title' maxlength='20' onkeyup="value=value.replace(/\s/g,'')" value="{$info.title}"/></td>
					<td  class='tit' id='tit' align='left'><font color='#858585'>1~20个字符区分大小写</font></td>
				</tr>
				
				<tr height='45px'>
					<td width='90px' align='right'><font color='#606062'>作者:</font>&nbsp&nbsp</td>
					<td align='left'><input type="text" name="author" onkeyup="value=value.replace(/\s/g,'')" class='title' id='title' maxlength='16' value="{$info.author}"/></td>
					<td><font color='#858585'></font></td>
				</tr>
				
				<!-- <tr height='45px'>
					<td align='right' ><font color='#606062'>上传文章封面图:</font>&nbsp&nbsp</td>
					<td  align='left' class='back' >
					<div id='backstyle_00' ></div>
					<div class="input_f">
						<input type='file' name='imageurl' class='imageurl' id='imageurl' size='49' style="width:360px;"/>
					</div>  
					</td>
					<td class='iurl'align='left'><font color='#858585'>图片类型须jpg/gif/png/jpeg</font></td>
				</tr> -->
				<if condition="!empty($list)">
				
				<tr height='45px'>
					<td align='right' ><span style='color:red'></span><font color='#606062'>分类:</font>&nbsp&nbsp</td>
					<td align='left'>
					  <if condition="$status eq 0">
					  <select name='cateid' id='catepid' class='catepid' >
						    <option value='0'>选择分类</option>
						    <volist id='vo' name='list'>
							<option value="{$vo.cateid}" <if condition="$vo['cateid'] eq $info['cateid']">selected="selected"</if>>{$vo.catename}</option>
							</volist>
				   		</select >
				   		<span id='span'></span>
				   	</if>
				   	<if condition="$status eq 1" >
				   		<select name='cateid' id='catepid' class='catepid' >
						    <option value='0' selected="selected">选择分类</option>
						    <volist id='vo' name='list'>
							<option value="{$vo.cateid}" >{$vo.catename}</option>
							</volist>
				   		</select >
				   		<span id='span'></span>
				   	</if>
				   	<if condition="$status eq 2">
				   		<select name='catepid' id='catepid' class='catepid' style='width:145px;'>
						    <option value='0' >选择分类</option>
						    <volist id='vo' name='list'>
							<option value="{$vo.cateid}" <if condition="$vo['cateid'] eq $catepid">selected="selected"</if>>{$vo.catename}</option>
							</volist>
				   		</select >
				   		<span id='span'>
				   		<select name='cateid' id='cateid' class='catepid' style='width:145px;'>
				   			<volist id='vo' name='listx'>
							<option value="{$vo.cateid}" <if condition="$vo['cateid'] eq $info['cateid']">selected="selected"</if>>{$vo.catename}</option>
							</volist>
				   		</select>
				   		</span>
				   	</if>
				   	</td>
				   <td></td>
				</tr>
				</if>
				
				<tr height='45px'>
					<td  align='right'><font color='#606062'>关键字:</font>&nbsp&nbsp
					<td align='left'><input type="text" name='keyword' class='keyword' id='keyword' maxlength='24' value="{$info.keyword}"/></td>
					<td class='keyw' id='keyw'align='left'><font color='#858585'>关键字用|隔开</font></td>
					
				</tr>
				
				<tr height='45px'>
					<td align='right'><span style='color:red'>*</span><font color='#606062'>文章上传:</font>&nbsp&nbsp</td>
					<td align='left' class='back'><div id='backstyle_01' ></div>
					<div class="input_f">
					<input name="url" id="url" type="file" class='url' id='url'size='49' style="width:360px;"/>
					</div>
					</td>
					<td></td>
				</tr>
				
				<tr height='175px'>
					<td align='right' valign='top' ><span style='color:red;'>*</span><font color='#606062'>信息摘要:</font>&nbsp&nbsp</td>
					<td align='left' class='desc'><textarea name='desc' id='desc' class='desc' style='width:300'>{$info.desc}</textarea></td>
					<td></td>
				</tr>
				
				
				<tr height='45px'>
					<td align='right'><font color='#606062'>下载所需积分:</font>&nbsp&nbsp</td>
					<td align='left'>
						<input type="text" onkeyup="value=value.replace(/[^\d]/g,'')"
      onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="{$info.downscore}" style="height:25px; line-height:25px;border: 1px solid #C4C4C4; padding-left:3px;" size="6" name="downscore" />
						<!-- <input name="downscore" type="radio" value="5" width='100px'checked/><font color='#606062'>5分</font>
						<input name="downscore" type="radio" value="10" style='margin-left:30px'/><font color='#606062'>10分</font>--></td>
					    <td></td>
				</tr>
				
				<input type="hidden" name="uid" value="{:getUserInfo('uid')}" />
				
				<tr>
					<td colspan='2' align='left' height='110px'><input type='button' value="提交" class='sub' id='sub' > <input type='reset' value="重置" class='reset'></td><td></td>
				</tr>
			</table>
		</form>
	</div>
	<div class='tid' id='tid_suc'>
		<div class="fL tk_l">
			
		</div>
		<div class='fL tk_c'>
			<div class='tk_tit'>
				提示框
			</div>
			<div class='tk_cont'>
				<p class='tk_info'>您的资源上传成功，管理员审核后可以查看。</p>
			</div>
			<input type='button' class='tk_sub' id='su' class='su'/>
		</div>
		<div class='fR tk_r'>
			
		</div>
		<div class='clear'></div>
  </div>
	
  	<div class='tid' id='tid_fail'>
		<div class="fL tk_l">
			
		</div>
		<div class='fL tk_c'>
			<div class='tk_tit'>
				提示框
			</div>
			<div class='tk_cont'>
				<p class='tk_info'><font color='red' style='font-weight:bold'>资源上传失败：{$error}</font></p>
			</div>
			<input type='button' class='tk_sub' id='su' class='su'/>
		</div>
		<div class='fR tk_r'>
			
		</div>
		<div class='clear'></div>
  </div>
	
</div>
</body>
</html>
